﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Wpf.CommonTools.SystemExtension;

namespace Wpf.CommonTools.Converter
{
    public class StringNullableConverter : IValueConverter
    {
        #region IValueConverter 成员

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value.ToString() != string.Empty)
            {
                return value;
            }
            else
            {
                string a= UILanguage.TryFindResource(parameter.ToString());
                return a;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
            //if (value != null && value.ToString() != string.Empty)
            //{
            //    return value;
            //}
            //else
            //{
            //    string a = UILanguage.TryFindResource(parameter.ToString());
            //    return a;
            //}
        }

        #endregion
    }
}
